#include "NetWorkSessionSettings.h"

#include "Online/OnlineSessionNames.h"

FNetworkSessionSettings::FNetworkSessionSettings(bool bIsLAN, bool bIsPresence, int32 MaxNumPlayers) {
    NumPublicConnections = MaxNumPlayers;
    if (NumPublicConnections < 0) {
        NumPublicConnections = 0;
    }
    NumPrivateConnections = 0;
    bIsLANMatch = bIsLAN;
    bShouldAdvertise = true;
    bAllowJoinInProgress = true;
    bAllowInvites = true;
    bUsesPresence = bIsPresence;
    bAllowJoinViaPresence = true;
    bAllowJoinViaPresenceFriendsOnly = false;
}

FNetworkSearchSettings::FNetworkSearchSettings(bool bSearchingLAN, bool bSearchingPresence) {
    bIsLanQuery = bSearchingLAN;
    MaxSearchResults = 10;
    PingBucketSize = 50;

    if (bSearchingPresence) {
        QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
    }
}

FNetworkSearchSettingsEmptyDedicated::FNetworkSearchSettingsEmptyDedicated(
    bool bSearchingLAN, bool bSearchingPresence) : FNetworkSearchSettings(bSearchingLAN, bSearchingPresence) {
    QuerySettings.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals);
    QuerySettings.Set(SEARCH_EMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals);
}
